#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,a[100005];
vector<int> group,can;
ll ans=0;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    sort(a+1,a+n+1);
    int cnt=0;
    for(int i=1;i<n;i++){
        cnt++;
        if(a[i]!=a[i+1]){
            group.push_back(cnt);
            can.push_back(cnt);
            cnt=0;
        }
    }
    group.push_back(cnt+1);
    can.push_back(cnt+1);
    for(int i=0;i<group.size();i++){
        int j=i+1;
        while(group[i]&&j<group.size()){
            if(can[j]>=group[i]){
                group[i]=0;
                can[j]-=group[i];
                break;
            }else{
                group[i]-=can[j];
                can[j]=0;
                j++;
            }
        }
    }
    for(auto x:group){
        ans+=x;
    }
    printf("%lld",ans);
    return 0;
}
